package com.golddaymicromall.util;

import java.util.Random;

/**
 * Created by dawd on 2016/5/26.
 */
public class RandomUtils {
    public static Random mRandom = new Random();

    public static String getRandom(int length){
        StringBuilder ret = new StringBuilder();
        for (int i = 0;i< length;i++){
            boolean isChar = (mRandom.nextInt(2) % 2 == 0);
            if(isChar){
                int choice = mRandom.nextInt(2) % 2 == 0 ? 65 :97;
                ret.append((char)(choice + mRandom.nextInt(26)));
            }else{
                ret.append(Integer.toString(mRandom.nextInt(10)));
            }
        }
        return  ret.toString();
    }
}
